// Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace PfRep.DataEntities
{
    /// <summary>
    /// An action plan associated with the given folder
    /// </summary>
    public enum ActionPlan
    {
        MigrateToSharePoint = 1,
        Archived = 2,
        LobApp = 3,
        RemainsOnExchange = 4
    }
    
    /// <summary>
    /// A folder entity
    /// </summary>
    public class Folder
    {
        private DateTime _lastModified;
        
        public int ID;
        public string Name;
        public string Key;
        public bool Indexed;
        public int? ItemCount;
        public string OwnerName;
        public string OwnerEmail;
        public ActionPlan ActionPlan;
        public string ActionPlanName;
        public string Note;
        
        public TimeSpan PassedSinceLastModification;
        public List<Folder> Subfolders;

        public Folder()
        { }

        /// <summary>
        /// Last modification date
        /// </summary>
        public DateTime LastModified
        {
            get 
            { 
                return _lastModified; 
            }
            
            set 
            {
                _lastModified = value;

                // Counts the time passed since last modification
                if (_lastModified > DateTime.MinValue)
                    PassedSinceLastModification = _lastModified.Subtract(DateTime.Now);
            }
        }

        public Folder(
            int id, 
            string name, 
            string key, 
            bool indexed, 
            int itemcount, 
            DateTime lastModified,
            string ownerName,
            string ownerEmail,
            ActionPlan actionPlan,
            string actionPlanName,
            string note)
        {
            ID = id;
            Name = name;
            Key = key;
            Indexed = indexed;
            ItemCount = itemcount;
            LastModified = lastModified;
            OwnerName = ownerName;
            OwnerEmail = ownerEmail;
            ActionPlan = actionPlan;
            ActionPlanName = actionPlanName;
            Note = note;
        }
    }
}
